package com.gaohe.scp.service.impl;

import java.util.List;
import com.gaohe.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gaohe.scp.mapper.CsCollectMapper;
import com.gaohe.scp.domain.CsCollect;
import com.gaohe.scp.service.ICsCollectService;

/**
 * 用户收藏Service业务层处理
 * 
 * @author liuxiangyu
 * @date 2025-03-25
 */
@Service
public class CsCollectServiceImpl implements ICsCollectService 
{
    @Autowired
    private CsCollectMapper csCollectMapper;

    @Override
    public int selectByUserId(Long userId,Long carId)
    {
//        csCarVisit.setCreateTime(DateUtils.getNowDate());
        return csCollectMapper.selectByUserId(userId,carId);
    }

    @Override
    public int deleteCsCollectByCarId(Long userId,Long carId)
    {
        return csCollectMapper.deleteCsCollectByCarId(userId,carId);
    }
    /**
     * 查询用户收藏
     * 
     * @param collectId 用户收藏主键
     * @return 用户收藏
     */
    @Override
    public CsCollect selectCsCollectByCollectId(Long collectId)
    {
        return csCollectMapper.selectCsCollectByCollectId(collectId);
    }

    /**
     * 查询用户收藏列表
     * 
     * @param csCollect 用户收藏
     * @return 用户收藏
     */
    @Override
    public List<CsCollect> selectCsCollectList(CsCollect csCollect)
    {
        return csCollectMapper.selectCsCollectList(csCollect);
    }

    /**
     * 新增用户收藏
     * 
     * @param csCollect 用户收藏
     * @return 结果
     */
    @Override
    public int insertCsCollect(CsCollect csCollect)
    {
        csCollect.setCreateTime(DateUtils.getNowDate());
        return csCollectMapper.insertCsCollect(csCollect);
    }

    /**
     * 修改用户收藏
     * 
     * @param csCollect 用户收藏
     * @return 结果
     */
    @Override
    public int updateCsCollect(CsCollect csCollect)
    {
        csCollect.setUpdateTime(DateUtils.getNowDate());
        return csCollectMapper.updateCsCollect(csCollect);
    }

    /**
     * 批量删除用户收藏
     * 
     * @param collectIds 需要删除的用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteCsCollectByCollectIds(Long[] collectIds)
    {
        return csCollectMapper.deleteCsCollectByCollectIds(collectIds);
    }

    /**
     * 删除用户收藏信息
     * 
     * @param collectId 用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteCsCollectByCollectId(Long collectId)
    {
        return csCollectMapper.deleteCsCollectByCollectId(collectId);
    }
}
